import News from '@/models/news';
import NewsService from '@/services/news';
import { action, observable } from 'mobx';
import { homeStore } from './home';

/**
 * 局部列表Store
 *
 * 调用了 `homeStore.number`
 */
export default class ListStore {
  @observable
  newsList?: Array<News>;
  @observable
  newsListLoading: boolean = false;

  @action
  async listNews() {
    this.newsListLoading = true;
    this.newsList = (await NewsService.list(1, homeStore.number)).dataList;
    this.newsListLoading = false;
  }
}
